package com.example.server.handle;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class TokenCache {

    // key: token, value: username
    private final static Map<String, String> TOKEN_MAP = new ConcurrentHashMap<>();

    public static void add(String token, String username) {
        TOKEN_MAP.put(token, username);
    }

    public static void remove(String token) {
        TOKEN_MAP.remove(token);
    }

    public static boolean isExist(String token) {
        return TOKEN_MAP.containsKey(token);
    }

}
